loading.. Please Wait

Aliquam repellendus consequatur voluptas labore et est.

  • Last Created On May 11, 2015
  • 101
4 5

You must be logged in and have valid account to access this content.

Views: 101

Recent Articles

  • Voluptatum est sint quae recusandae dolo...
    50
  • Maxime repudiandae incidunt doloremque r...
    50
  • Atque excepturi quia voluptatem magnam q...
    100
  • Sed culpa quis blanditiis cupiditate occ...
    100
  • At molestias qui enim velit hic molestia...
    50

Popular Articles

  • Aliquam repellendus consequatur voluptas...
    101
  • Dolores modi dolorem ab omnis sit.
    101
  • Cupiditate saepe ipsa consequuntur nisi...
    101
  • Atque excepturi quia voluptatem magnam q...
    100
  • Sed culpa quis blanditiis cupiditate occ...
    100
`; // // Send AJAX request // fetch('https://uhelp.spruko.com/uhelp/translate', { // method: 'POST', // headers: { // 'Content-Type': 'application/json', // 'X-CSRF-TOKEN': 'JuT0DVcHtQSfQTAPCNp1YAw8xiM8z8Ddl2p3Z4cd', // }, // body: JSON.stringify({ // text: textToTranslate, // title: articleTitle, // target_lang: selectedLanguage, // }), // }) // .then(response => response.json()) // .then(data => { // if (data.success) { // modal.hide(); // console.log(data.translated_text); // document.querySelector('.description').innerHTML = data.translated_text; // document.querySelector('.articletitle').innerHTML = data.translated_title; // } else { // toastr.error('Translation failed: ' + data.message); // } // }) // .catch(error => { // console.error('Error:', error); // alert('An error occurred.'); // }); // }); document.getElementById('translateButtonSave').addEventListener('click', function () { const selectedLanguage = document.getElementById('translate-lang').value; const textToTranslate = document.querySelector('.description'); const articleTitle = document.querySelector('.articletitle').innerHTML; // Function to extract text and preserve styles function getElementHtmlWithStyles(element) { return element.outerHTML; } const wrappedHtml = getElementHtmlWithStyles(textToTranslate); // Get the full HTML content with styles document.querySelector('.articlecard').style.filter = "blur(2px)"; document.getElementById('hideAfterloading')?.classList.remove('d-none'); modal.hide(); fetch('https://uhelp.spruko.com/uhelp/translate', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': 'JuT0DVcHtQSfQTAPCNp1YAw8xiM8z8Ddl2p3Z4cd', }, body: JSON.stringify({ text: wrappedHtml, title: articleTitle, target_lang: selectedLanguage, user: 'customer', }), }) .then(response => response.json()) .then(data => { if (data.success) { document.querySelector('.articlecard').style.filter = ""; document.getElementById('hideAfterloading')?.classList.add('d-none'); document.querySelector('.description').innerHTML = data.translated_text; document.querySelector('.articletitle').innerHTML = data.translated_title; } else { toastr.error('Translation failed: ' + data.message); document.querySelector('.articlecard').style.filter = ""; document.getElementById('hideAfterloading')?.classList.add('d-none'); } }) .catch(error => { console.error('Error:', error); alert('An error occurred.'); }); });